import React,{useState} from 'react'

export default function Test() {
    const [a, seta] = useState(1)
    const [b, setb] = useState(2);
    const [c, setc] = useState(3);
    function fnA(a1){
        return new Promise((resolve)=>{
            seta(a1);
            resolve(a1);
        })
    }
    function fnB(b1){
        return new Promise((resolve)=>{
            setb(b1);
            resolve(b1);
        })
    }
    function fnC(c1){
        return new Promise((resolve)=>{
            setc(c1);
            resolve(c1);
        })
    }

  return (
    <div>Test
        <button onClick={()=>{
            fnA(4).then((data)=>{
                console.log(data);
                return fnB(5)
            }).then((data)=>{
                console.log(data);
                return fnC(6)
            }).then((data)=>{
                console.log(data);/*  */
                console.log(a,b,c);
            })
        }}>获取值</button>
    </div>
  )
}
